<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PinCRT: Pin OS-APIs User Guide</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">PinCRT
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Pin OS-APIs User Guide </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><hr  />
 <h1><a class="anchor" id="autotoc_md1"></a>
@section INTRO Introduction</h1>
<p>OS-APIs is a set of functions that provides a generic way to interact with the OS. The OS interaction types include: file operations, process creation and manipulation, inter-process communication, etc. See list of all supported operations <a href="modules.html">here</a></p>
<hr  />
 <h1><a class="anchor" id="autotoc_md3"></a>
@section COMPAT Mapping between OS specific API functions to OS-APIs functions</h1>
<table style="width:100%">
<tr valign="top" align="left">
<td><b>OS-APIs</b> </td><td><b>POSIX (Linux and macOS*)</b> </td><td><b>WIN32</b>  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga38a707fb6f53313ee7c24d75caa51b63">OS_GetFileAttributes()</a> </td><td>stat() lstat() </td><td>GetFileAttributes()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gac668ae6bc73afec7519aaf999118e7a2">OS_GetFDAttributes()</a> </td><td>fstat() </td><td>GetFileInformationByHandle()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga40b4d1b8edd74fb9f1a117d4e9765efd">OS_OpenFD()</a> </td><td>open() creat() </td><td>CreateFile() CreateFileEx() OpenFile()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga84a9342eec9a5358636f49ea2c817b43">OS_WriteFD()</a> </td><td>write() </td><td>WriteFile() WriteFileEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gad90001eac7b50ec5a2df0e19484321f4">OS_ReadFD()</a> </td><td>read() </td><td>ReadFile() ReadFileEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga23a588dc0dccb95913681fbb7a02d22b">OS_SeekFD()</a> </td><td>lseek() llseek() lseek64() </td><td>SetFilePointer() SetFilePointerEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga2c0fb2fdbfd986c4c5ad03f0237e56e5">OS_CloseFD()</a> </td><td>close() </td><td>CloseHandle()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gaf12497d2883236cddea461efcd1ff3c2">OS_DeleteFile()</a> </td><td>unlink() unlinkat() </td><td>DeleteFile()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gab62ec17a32d86493f24fbc83964d12b2">OS_FlushFD()</a> </td><td>fsync() fdatasync() </td><td>FlushFileBuffers()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga13d679b9085d6fa1db37b2816dc86bef">OS_FilePermissionsFD()</a> </td><td>fstat() </td><td>GetFileAttributes()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga491827c8e00c29e9d0ba9a2ef9b3cd59">OS_FileSizeFD()</a> </td><td>fstat() </td><td>GetFileSize() GetFileSizeEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga1a590d06769c84c9a60f48f9b5669c73">OS_Cwd()</a> </td><td>cwd() </td><td>GetCurrentDirectory()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga4e58fdad8fb7819318047b3e835a8e02">OS_Chdir()</a> </td><td>chdir() </td><td>SetCurrentDirectory()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga20fb89cc9569d6312fea52d24608baf2">OS_OpenDirFD()</a> </td><td>open() </td><td>OpenFile() CreateFile()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga89de07f95f92263c15308eecfd5c2445">OS_MkDir()</a> </td><td>mkdir() </td><td>CreateDirectory() CreateDirectoryEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gaad7416af279aaf0f33279ce6d732f0ad">OS_DeleteDirectory()</a> </td><td>rmdir() </td><td>RemoveDirectory()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga2dd6bf508fd9aeab2a371a3c1d4e285c">OS_IsConsoleFD()</a> </td><td>isatty() </td><td>GetObjectType()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gabd5a0efabfd2ca004cb9ad6d1f0f8d2c">OS_GetFDAccessMode()</a> </td><td>fcntl() </td><td>NtQueryObject()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gad067813c5642c1a4dfe3f8ea9ac9407c">OS_ReadDirectoryFD()</a> </td><td>getdents64() getdents() </td><td></td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#gac1b3420b3c0884a71cb7d00e010b43f0">OS_RenameFile()</a> </td><td>rename() </td><td>MoveFile()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__FILE.html#ga91ad7341f68a52f66ab515afa4ac277b">OS_ReadLink()</a> </td><td>readlink() </td><td></td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__IPC.html#ga14a140fa66c2f5d69e59dc0900d8b56b">OS_Pipe()</a> </td><td>pipe() </td><td>CreatePipe()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__HOST.html#gaa5eea5ebfb007d1e0f818444680f6d2a">OS_GetHostName()</a> </td><td>uname() </td><td>GetComputerName() GetComputerNameEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__HOST.html#ga78c280fd813beaea5d9347a6d06836fb">OS_GetHostCPUArch()</a> </td><td>uname() </td><td>IsWow64Process()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__HOST.html#ga2fdf5c40bd8366f41ccddc7a89943a15">OS_GetOSVersion()</a> </td><td>uname() </td><td>GetVersion() GetVersionEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#ga292fe0be7839ed9cc970254d288bb199">OS_AllocateMemory()</a> </td><td>mmap() </td><td>VirtualAlloc() VirtualAllocEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#ga8e79ecf1778b1d8e8488f15a28b1caea">OS_MapFileToMemory()</a> </td><td>mmap() </td><td>MapViewOfFile() MapViewOfFileEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#gaa54a94130bdeef23bf5e9b4666e6c430">OS_FreeMemory()</a> </td><td>munmap() </td><td>VirtualFree() VirtualFreeEx() UnmapViewOfFile()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#gaa76c49aabf3c8fdbfca2bf7a1d52a15e">OS_GetPageSize()</a> </td><td>getpagesize() </td><td>GetSystemInfo()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#ga66948315f215e7db3099719f7c81df3d">OS_QueryMemory()</a> </td><td></td><td>VirtualQuery() VirtualQueryEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__MEMORY.html#ga735acbcf7139e9d3a45988005a98854d">OS_ProtectMemory()</a> </td><td>mprotect() </td><td>VirtualProtect() VirtualProtectEx()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__PROCESS.html#ga289a76b88b164c1cfda0742645f7e8e5">OS_GetCommandLine()</a> </td><td></td><td>GetCommandLine()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__PROCESS.html#ga99c9c3d3b11c60be66224a102d95a867">OS_GetEnvironmentBlock()</a> </td><td>environ </td><td>GetEnvironmentVariable() SetEnvironmentVariable()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__THREAD.html#gaa87c77702ceb0356089d8478bd630c55">OS_SuspendThread()</a> </td><td>kill() tkill() tgkill() </td><td>SuspendThread()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__THREAD.html#ga0263cb6e9d2ed19869dd3b94d17216af">OS_ResumeThread()</a> </td><td>kill() tkill() tgkill() </td><td>ResumeThread()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__THREAD.html#ga840329607e681a7ba8ebb941fc5745c5">OS_GetTid()</a> </td><td>gettid() </td><td>GetCurrentThreadId()  </td></tr>
<tr valign="top" align="left">
<td><a class="el" href="group__OS__APIS__PROCESS.html#ga0b17ba1327ccfea88254c4f756fef977">OS_GetPid()</a> </td><td>getpid() </td><td>GetCurrentProcessId()  </td></tr>
</table>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
